<?php
	/*
	  +----------------------------------------------------------------------+
	  | PHP Version 5                                                        |
	  +----------------------------------------------------------------------+
	  | Copyright (c) 1997-2009 The PHP Group                                |
	  +----------------------------------------------------------------------+
	  | This source file is subject to version 3.0 of the PHP license,       |
	  | that is bundled with this package in the file LICENSE, and is        |
	  | available through the world-wide-web at the following url:           |
	  | http://www.php.net/license/3_0.txt.                                  |
	  | If you did not receive a copy of the PHP license and are unable to   |
	  | obtain it through the world-wide-web, please send a note to          |
	  | license@php.net so we can mail you a copy immediately.               |
	  +----------------------------------------------------------------------+
	  | Author:      Kalle Sommer Nielsen <kalle@php.net>                    |
	  +----------------------------------------------------------------------+
	*/

	/* $Id$ */


	/*
	 * Configuration
	 *
	 *  Defines username and passwords respectively used 
	 *  for authenticating on Twitter
	 */
	define('TWITTER_LOGIN', 	'');
	define('TWITTER_PASSWORD', 	'');


	/*
	 * Utility function(s)
	 */
	function error($message)
	{
		die('ERROR: ' . $message . PHP_EOL);
	}


	if(!extension_loaded('Twitter'))
	{
		error('Twitter extension not loaded');
	}

	if(!defined('TWITTER_LOGIN') || !defined('TWITTER_PASSWORD'))
	{
		error('Twitter login and password constants must be defined');
	}

	array_shift($argv);
	$status = implode(' ', $argv);

	try
	{
		$twitter = new Twitter(TWITTER_LOGIN, TWITTER_PASSWORD);
		$twitter->update($status);
	}
	catch(Exception $e)
	{
		error($e->getMessage());
	}
?>